package com.example.demo.Interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.HandlerInterceptor;

public class Login_interceptor implements HandlerInterceptor {
@Override
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
		throws Exception {
	if(request.getSession().getAttribute("user")==null) {
		response.sendRedirect("/login.html");	
		return false;
	}else
	return HandlerInterceptor.super.preHandle(request, response, handler);
}
}
